<script type="text/javascript" src="<?=base_url()?>resource/js/layer/layer.js"></script>
<script type="text/javascript" src="<?=base_url()?>resource/js/echarts.js"></script>
<script type="text/javascript" src="<?=base_url()?>resource/plugins/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript">
    $(function(){
        var point='<?=$keyword['point']?>';
        var type='<?=$keyword['type']?>';
        var timeLine='<?=$keyword['timeLine']?>';
        if(point){
            $('#point').val(point);
        }
        if(type){
            $('#type').val(type);
        }
        if(timeLine){
            $('#timeLine').val(timeLine);
        }
        $("select[data-edit-select]").filterSelect();
    });
</script>
<!--top结束-->
<div class="mian">
    <div class="mian1">
        <div class="mian2">
            <!--left start-->
            <?php $this->load->view('defaults/common/left');?>
            <!--left end-->

            <!--right start-->
            <div class="right">
                <!--breadcrumb start-->
                <div class="righta"></div>
                <!--breadcrumb end-->

                <!-- contents start -->
                <div id="contents">
                    <div id="ct_search" >
                        <form action="<?=blang_url('maintainReport/maintainReport/repairComprehensiveKpi/')?>" method="post" enctype="multipart/form-data" name="searchform" >
                            <table id="search_tb">
                                <tr>
                                    <td style="overflow: visible;">
                                        站点:
                                        <select name="point" id="point">
                                            <?php foreach($pointList as $row){?>
                                                <option value="<?=$row['point']?>"><?=$row['point']?></option>
                                            <?php }?>
                                        </select>
                                        起始时间:<input type="text" name="sTime" value="<?=$keyword['sTime']?>" onfocus="WdatePicker({lang:'en'})" class="sTime">
                                        结束时间:<input type="text" name="nTime" value="<?=$keyword['nTime']?>" onfocus="WdatePicker({lang:'en'})" class="nTime">
                                        时间区间：
                                        <select name="timeLine" id="timeLine">
                                            <option value="1">天</option>
                                            <option value="7">周</option>
                                            <option value="15">半月</option>
                                            <option value="30">月</option>
                                            <option value="90">季度</option>
                                        </select>
                                        <input type="submit" name="searchSubmit" value="<?=lang('file_cx')?>" />&nbsp;&nbsp;&nbsp;&nbsp;
                                    </td>
                                </tr>
                            </table>
                        </form>
                    </div>
                    <div class="ct_content">
                        <div id="main" style='height:600px;width: 1200px;'></div>
                        <script>
                            var myChart = echarts.init(document.getElementById('main'));
                            var datas = JSON.parse('<?=$eCharts?>');
                            option = {
                                baseOption: {
                                    timeline: {
                                        // y: 0,
                                        axisType: 'category',
                                        // realtime: false,
                                        // loop: false,
                                        // currentIndex: 2,
                                        playInterval: 1000,
                                        // controlStyle: {
                                        //     position: 'left'
                                        // },
                                        data: datas['time'],
                                        tooltip: {
                                            formatter: '{b}'
                                        }
                                    },
                                    title: {
                                        subtext: '数据来自丹宏昊天网络科技有限公司'
                                    },
                                    tooltip: {
                                        trigger: 'item',
                                        formatter: "{a} <br/>{b} : {c}"
                                    },
                                    legend: {
                                        x: 'right',
                                        data: ['质检','开始维修','报价','确认报价','维修中','维修中等待配件','维修完成','QC完成','完结']
                                    },
                                    calculable: true,
                                    grid: {
                                        top: 80,
                                        bottom: 100,
                                        width:800
                                    },
                                    xAxis: [{
                                        'type': 'category',
                                        'axisLabel': {
                                            'interval': 0
                                        },
                                        'data': [
                                            '<?=$keyword['point']?>'
                                        ],
                                        splitLine: {
                                            show: false
                                        }
                                    }],
                                    yAxis: [{
                                        name: '时长(天)',
                                        type: 'value',
                                        axisLabel: {
                                            formatter: '{value}'
                                        }
                                    }],
                                    series: [{
                                        name: '质检',
                                        type: 'bar',
                                        itemStyle:{
                                            normal:{
                                                label:{
                                                    show:true,position:'top',formatter:'{c}'
                                                }
                                            }
                                        }
                                    },{
                                        name: '开始维修',
                                        type: 'bar',
                                        itemStyle:{
                                            normal:{
                                                label:{
                                                    show:true,position:'top',formatter:'{c}'
                                                }
                                            }
                                        }
                                    }, {
                                        name: '报价',
                                        type: 'bar',
                                        itemStyle:{
                                            normal:{
                                                label:{
                                                    show:true,position:'top',formatter:'{c}'
                                                }
                                            }
                                        }
                                    }, {
                                        name: '确认报价',
                                        type: 'bar',
                                        itemStyle:{
                                            normal:{
                                                label:{
                                                    show:true,position:'top',formatter:'{c}'
                                                }
                                            }
                                        }
                                    }, {
                                        name: '维修中',
                                        type: 'bar',
                                        itemStyle:{
                                            normal:{
                                                label:{
                                                    show:true,position:'top',formatter:'{c}'
                                                }
                                            }
                                        }
                                    }, {
                                        name: '维修中等待配件',
                                        type: 'bar',
                                        itemStyle:{
                                            normal:{
                                                label:{
                                                    show:true,position:'top',formatter:'{c}'
                                                }
                                            }
                                        }
                                    }, {
                                        name: '维修完成',
                                        type: 'bar',
                                        itemStyle:{
                                            normal:{
                                                label:{
                                                    show:true,position:'top',formatter:'{c}'
                                                }
                                            }
                                        }
                                    }, {
                                        name: 'QC完成',
                                        type: 'bar',
                                        itemStyle:{
                                            normal:{
                                                color:'cyan',
                                                label:{
                                                    show:true,position:'top',formatter:'{c}'
                                                }
                                            }
                                        }
                                    }, {
                                        name: '完结',
                                        type: 'bar',
                                        itemStyle:{
                                            normal:{
                                                color:'#ff33ff',
                                                label:{
                                                    show:true,position:'top',formatter:'{c}'
                                                }
                                            }
                                        }
                                    }]
                                },
                                options: [
                                    <?php foreach($time as $key=>$val){?>
                                    {
                                        title: {
                                            text: '<?=strtoupper($keyword['point'])?>#<?=$val?>订单状况(<?=$keyword['typeName']?>)'
                                        },
                                        series: [{
                                            data: [datas['data']['<?=$val?>'][0]]
                                        },{
                                            data: [datas['data']['<?=$val?>'][1]]
                                        },{
                                            data: [datas['data']['<?=$val?>'][2]]
                                        },{
                                            data: [datas['data']['<?=$val?>'][3]]
                                        },{
                                            data: [datas['data']['<?=$val?>'][4]]
                                        },{
                                            data: [datas['data']['<?=$val?>'][8]]
                                        },{
                                            data: [datas['data']['<?=$val?>'][5]]
                                        },{
                                            data: [datas['data']['<?=$val?>'][6]]
                                        },{
                                            data: [datas['data']['<?=$val?>'][7]]
                                        } ]
                                    },
                                    <?Php }?>
                                ]
                            };
                            myChart.setOption(option);
                        </script>
                    </div>
                </div>
                <!-- contents end -->
            </div>
            <!--right end-->
            <div class="clear" ></div>
        </div>
    </div>
</div>
